<?php
class configLayer {
	private static $data = array('system_version' => '0.1a');
	
	public static function load( $lol = false ) {
		if( $lol )
			self::$data = array('system_version' => '0.1a');
		foreach( dbLayer::query('SELECT `name`, `value` FROM `cms_settings`;')->fetchAll() as $cfg ) {
			self::$data[$cfg['name']] = $cfg['value'];
		}
		
		return true;
	}
	
	public static function get( $name ) {
		return self::$data[$name];
	}
	
	public static function getAll() { return self::$data; }
	
	public static function set( $name, $value ) {
		dbLayer::query("UPDATE `cms_settings` SET `value`=\"$value\" WHERE `name`=\"$name\";");
		self::load(true);
	}
}
?>